<template>
  <div class="body">
    <v-head></v-head>
    <!-- <Row class="restand">
        <i-col class="standkepu" span="22">
          <div class="detail">
            <div class="shijianzhoux" >
              <Row>
                  <i-col class="bookitem" span="6" v-for="(item,index) in booklist" :key="'infoji'+index">
                    <img class="bookfeng" @click='gedetail(item.id)' :src="'http://172.168.16.247:8099/'+item.metaDescription" alt="">
                    <p class="booktitle">{{item.title}}</p>
                  </i-col>
              </Row>
              <Page class="bookpage" :total="dataCount" :page-size="pageSize" show-total @on-change="changepage" v-if="showPage" class-name="changepage" show-elevator />
            </div>
          </div>
        </i-col>
    </Row> -->
    <Row class="restand">
        <i-col class="standkepudigndan" span="17">
        <div class="standardt">
            图书
        </div>
        <div class="result">
            <Row class="orderrow" v-for="(item,index) in showlist" :key="index">
            <i-col span="1">
                <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
                <span class="itemtitle">{{item.title}}</span>
                <br>
                <span class="itemtitle">ISBN号:&#12288;&#12288;{{item.ISBN}}</span>
                <span class="itemtitle">&#12288;&#12288;作者:&#12288;&#12288;{{item.author}}</span>
                <span class="itemtitle">&#12288;&#12288;书架:&#12288;&#12288;{{item.bookShelf}}</span>
                <span class="itemtitle">&#12288;&#12288;书架号:&#12288;&#12288;{{item.bookShelfNumber}}</span>
                <!-- <span class="itemtitle">{{item.clc}}</span>
                <span class="itemtitle">{{item.edition}}</span>
                <span class="itemtitle">{{item.lend}}</span>
                <span class="itemtitle">{{item.press}}</span> -->
                <span class="itemtitle">&#12288;&#12288;价格:&#12288;&#12288;{{item.price}}</span>
                <!-- <span class="itemtitle">{{item.publishDate}}</span> -->
            </i-col>
            <i-col span="2">
                <div  class="itemtitledate">{{item.createDate}}</div>
            </i-col>
            </Row>
            <Page :total="dataCount" :page-size="pageSize" show-total @on-change="changepage" v-if="showPage" class-name="changepage" show-elevator />
        </div>
        </i-col>
    </Row>
    <!-- 标准 -->
    <Row class="restand">
        <i-col class="standkepudigndan" span="17">
        <div class="standardt">
            标准
        </div>
        <div class="result">
            <Row class="orderrow" v-for="(item,index) in dshowlist" :key="index">
            <i-col span="1">
                <div class="orderimg" alt=""></div>
            </i-col>
            <i-col span="20">
                <span class="itemtitle">&#12288;{{item.chName}}</span>
                <!-- <span class="itemtitle">{{item.barcode}}</span> -->
                <br>
                <span class="itemtitle">&#12288;书架:&#12288;{{item.bookShelf}}</span>
                <span class="itemtitle">&#12288;书架号:&#12288;{{item.bookShelfNumber}}</span>
                <!-- <span class="itemtitle">&#12288;分类:&#12288;{{item.category}}</span> -->
                <!-- <span class="itemtitle">{{item.chNo}}</span>
                <span class="itemtitle">{{item.discardDate}}</span>
                <span class="itemtitle">{{item.enName}}</span>
                <span class="itemtitle">{{item.enNo}}</span>
                <span class="itemtitle">{{item.lend}}</span>
                <span class="itemtitle">{{item.discardDate}}</span> -->
                <span class="itemtitle">&#12288;标准号:&#12288;{{item.standardNo}}</span>
                <span class="itemtitle">&#12288;标准状态:&#12288;{{item.standardState}}</span>
                <!-- <span class="itemtitle">&#12288;标准类型:&#12288;{{item.standardType}}</span> -->
            </i-col>
            </Row>
            <Page :total="ddataCount" :page-size="dpageSize" show-total @on-change="changepaged" v-if="dshowPage" class-name="changepage" show-elevator />
        </div>
        </i-col>
    </Row>
    <v-foot></v-foot>
    <Back-top></Back-top>
  </div>
</template>
<script>
export default {
  name: 'seniorsearch',
  data () {
    return {
      dataCount: 0,
      pageSize: 10,
      pageNum: 1,
      showPage: false,
      results: [],
      showlist: [],
      ddataCount: 0,
      dpageSize: 10,
      dpageNum: 1,
      dshowPage: false,
      dresults: [],
      dshowlist: []
    }
  },
  methods: {
    // 获取图书列表
    // getBooklist () {
    //   let uploadcc = { data: '{page: ' + this.pageNum + ', pagesize: ' + this.pageSize + ', cateid:"2740683d-8b60-4472-a9b0-a43af35385f1"}' }
    //   this.$axios.post(neturl + '/by/book/getlist', uploadcc
    //   ).then(res => {
    //     // console.log(res)
    //     this.booklist = res.data.data.result
    //     this.dataCount = res.data.data.records
    //     this.showPage = true
    //   })
    // },
    // 图书
    getNewlist () {
      // let uploadcc = { data: '{page: ' + this.pageNum + ', pagesize: ' + this.pageSize + ', cateid:"402881fb56a21c8f0157089d14970002"}' }
      this.$axios.get('http://148.70.43.175:8080/api/standard-books'
      ).then(res => {
        // console.log(res)
        this.results = res.data
        this.dataCount = res.data.length
        //
        if (this.dataCount < this.pageSize) {
          this.showlist = this.results
        } else {
          this.showlist = this.results.slice(0, this.pageSize)
        }
        this.showPage = true
        this.$Spin.hide()
      })
    },
    // 标准
    getDNoticelist () {
      this.$axios.get('http://148.70.43.175:8080/api/standard-documents'
      ).then(res => {
        console.log(res)
        this.dresults = res.data
        this.ddataCount = this.dresults.length
        if (this.ddataCount < this.dpageSize) {
          this.dshowlist = this.dresults
        } else {
          this.dshowlist = this.dresults.slice(0, this.dpageSize)
        }
        this.dshowPage = true
        this.$Spin.hide()
      })
    },
    changepage (value) {
      let _start = (value - 1) * this.pageSize
      let _end = value * this.pageSize
      this.showlist = this.results.slice(_start, _end)
      this.pageNum = value
    },
    changepaged (value) {
      // console.log(value)
      let _start = (value - 1) * this.dpageSize
      let _end = value * this.dpageSize
      this.dshowlist = this.dresults.slice(_start, _end)
      this.dpageNum = value
    }
    // gedetail (id) {
    //   let routeData = this.$router.resolve({path: '/bookdetail', query: {id: id}})
    //   window.open(routeData.href, '_blank')
    // }
  },
  created () {
    this.$Spin.show()
    // this.model1 = this.cityList[0].value
    this.userinfo = this.$cookie.get('user')
    this.userinfo = JSON.parse(this.userinfo)
    // 已登录
    if (this.userinfo != null) {
      this.islogin = true
      this.islog = false
      this.username = this.userinfo.realName
    }
    // this.getBooklist()
    this.getNewlist()
    this.getDNoticelist()
  }
}
</script>

<style scoped>
  @import '../assets/css/booklist.css';
</style>
